home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 08 - 1992 / 08.05 Sep 92 / Getting Started / Pascal Version / PICTWindow.p next >
Encoding:
Text File  |  1992-08-31  |  833 b   |  52 lines  |  [TEXT/PJMM]

  1. program PICTWindow;
  2.     const
  3.         kBaseResID = 128;
  4.  
  5. {————————————————>    WindowInit    <—-}
  6.     procedure WindowInit;
  7.         var
  8.             window: WindowPtr;
  9.     begin
  10.         window := GetNewWindow(kBaseResID, nil, WindowPtr(-1));
  11.  
  12.         if window = nil then
  13.             begin
  14.                 SysBeep(10);
  15.                 ExitToShell;
  16.             end;
  17.  
  18.         ShowWindow(window);
  19.         SetPort(window);
  20.     end;
  21.  
  22. {————————————————>    DrawMyPicture    <—-}
  23.     procedure DrawMyPicture;
  24.         var
  25.             pictureRect: Rect;
  26.             picture: PicHandle;
  27.     begin
  28.         picture := GetPicture(kBaseResID);
  29.  
  30.         if picture = nil then
  31.             begin
  32.                 SysBeep(10);
  33.                 ExitToShell;
  34.             end;
  35.  
  36.         pictureRect := picture^^.picFrame;
  37.  
  38.         OffsetRect(pictureRect, -pictureRect.left, -pictureRect.top);
  39.  
  40.         DrawPicture(picture, pictureRect);
  41.  
  42.         FrameRect(pictureRect);
  43.     end;
  44.  
  45. {————————————————>    PICTWindow    <—-}
  46. begin
  47.     WindowInit;
  48.     DrawMyPicture;
  49.  
  50.     while not Button do
  51.         ;
  52. end.